var thrift = require('thrift');
var HelloWorldService = require('./gen-nodejs/HelloWorldService.js');
var ttypes = require('./gen-nodejs/demoHello_types.js');

var transport = thrift.TBufferedTransport;
var protocol = thrift.TCompactProtocol;   //通讯协议

var connection = thrift.createConnection("localhost", 7091, {
  transport : transport,
  protocol : protocol
});

connection.on('error', function(err) {
	console.log("err==>"+err);
 // assert(false, err);
});

// Create a Calculator client with the connection
var client = thrift.createClient(HelloWorldService, connection);
/*var sayHello = new ttypes.sayHello();*/
client.sayHello("dddd",function(err, response) {
  console.log(response);
});
